package cn.edu.lcu.cs.javaprogramming.clazz;


import lombok.extern.java.Log;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.RepeatedTest;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

import java.time.Instant;
import java.time.temporal.ChronoUnit;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

@Log
public class StringDemo2 {
    Instant begin;
    Instant end;
    String src = "aksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfjaksjkjfksljgdklgjsljgslkgjslgjskdflgjsdkgljwejqwjrewj汉字右转sfjdskfj skdjf";

    @RepeatedTest(3)
    void toUpperCaseFirstLetter() {
        System.out.println("toUpperCaseFirstLetter1");
        if (src != null && src.length() >0) {
            char[] chars = src.toCharArray();
            chars[0] = Character.toUpperCase(chars[0]);
            String target = String.valueOf(chars);
        }
    }


    @RepeatedTest(3)
    void toUpperCaseFirstLetter2() {
        System.out.println("toUpperCaseFirstLetter2");
        if (src != null && src.length() >0) {
            StringBuilder sb = new StringBuilder(src);
            sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
            String target = sb.toString();
        }
    }

    @BeforeEach
    void beforeEach() {
        begin = Instant.now();
    }

    @AfterEach
    void afterEach() {
        end = Instant.now();
        System.out.println("耗费纳秒数：" + begin.until(end, ChronoUnit.NANOS));
        System.out.println("---------------------------------------------------------");
    }
}
